import assessCheckApi from './api'
import { axios } from '@/utils/request'
import router from '@/router/index'
import blobType from '@/common/blobType'
var menuType = blobType.menuType
var fywflcodeArr = blobType.fywflcodeArr
var fywflcode = ''
export function ocalityPostAction(data) {
  //console.log('字典传参',data)
  return axios({
    url: assessCheckApi.dict,
    method:'get' ,
    params:data,
    url_1:'outside'
  })
}
//问卷管理列表
export function wjjbxxPageList(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.wjjbxxPageList,
    method:'get' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}

//初始化
export function initWjjbxx(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.initWjjbxx,
    method:'get' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}
export function initPersonWjjbxx(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.initPersonWjjbxx,
    method:'post' ,
    data:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}


//查询问卷
export function viewWjjbxx(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.viewWjjbxx,
    method:'get' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}

//保存问卷
export function selectDjDa(params){
  return axios({
    url: assessCheckApi.selectDjDa,
    method:'post' ,
    data:{...params},
    url_1:'outside'
  })
}

//提交问卷
export function submitWj(params){
  return axios({
    url: assessCheckApi.submitWj,
    method:'post' ,
    data:{...params},
    url_1:'outside'
  })
}

//删除
export function deleteBatchWjjbxx(params){
  return axios({
    url: assessCheckApi.deleteBatchWjjbxx,
    method:'delete' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}

//添加修订
export function addWjtxtmxx(params){
  return axios({
    url: assessCheckApi.addWjtxtmxx,
    method:'get' ,
    params:{...params},
    url_1:'outside'
  })
}

//导出问卷选项
export function exportWjWriteSelectxxData(params){
  return axios({
    url: assessCheckApi.exportWjWriteSelectxxData,
    method:'get' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside',
    responseType: 'arraybuffer'
  })
}
export function exportWjWriteTkxxData(params){
  return axios({
    url: assessCheckApi.exportWjWriteTkxxData,
    method:'get' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside',
    responseType: 'arraybuffer'
  })
}

//新增问卷
export function spcyWjWjjbxxAddWjjbxx(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxAddWjjbxx,
    method:'post' ,
    data:{...params},
    url_1:'outside'
  })
}


export function spcyWjWjjbxxAddWjDbt(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxAddWjDbt,
    method:'post' ,
    data:{...params},
    url_1:'outside'
  })
}

export function spcyWjWjjbxxEditWjDbt(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxEditWjDbt,
    method:'put' ,
    data:{...params},
    url_1:'outside'
  })
}

export function spcyWjWjjbxxDeleteWjDbt(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxDeleteWjDbt,
    method:'delete' ,
    params:{...params},
    url_1:'outside'
  })
}

export function spcyWjWjjbxxDeleteBatchWjtm(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxDeleteBatchWjtm,
    method:'delete' ,
    params:{...params},
    url_1:'outside'
  })
}

export function spcyWjWjjbxxAddWjtm(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxAddWjtm,
    method:'post' ,
    data:{...params},
    url_1:'outside'
  })
}
export function answerAdd(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxAddWjtmxx,
    method:'post' ,
    data:{...params},
    url_1:'outside'
  })
}

export function answerEdit(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxEditWjtmxx,
    method:'put' ,
    data:{...params},
    url_1:'outside'
  })
}

export function answerDelete(params){
  return axios({
    url: assessCheckApi.deleteBatchWjtmxx,
    method:'delete' ,
    params:{...params},
    url_1:'outside'
  })
}
export function answerList(params){
  return axios({
    url: assessCheckApi.queryWjtmxxById,
    method:'get' ,
    params:{...params},
    url_1:'outside'
  })
}


export function editWjjbxx(params){
  return axios({
    url: assessCheckApi.editWjjbxx,
    method:'put' ,
    data:{...params},
    url_1:'outside'
  })
}
export function spcyWjWjjbxxEditWjtm(params){
  return axios({
    url: assessCheckApi.spcyWjWjjbxxEditWjtm,
    method:'put' ,
    data:{...params},
    url_1:'outside'
  })
}


export function wjStatqueryWjtmStatCount(params){
  return axios({
    url: assessCheckApi.wjStatqueryWjtmStatCount,
    method:'get' ,
    params:{...params},
    url_1:'outside'
  })
}







